# coding=utf-8


from openpyxl import Workbook  #Workbook 首字母大写
from xlrd import open_workbook
import xlwt
from openpyxl import load_workbook  #打开文件  首字母不用大写
import os

# 获取当前文件目录
path = os.path.dirname(os.path.abspath(__file__))
fpath = os.path.split(path)[0] + '/testdata'
print fpath

# 练习读取excel文件

def getRowsData(filename, sheetname, rawnum):
    filepath = os.path.join(fpath, filename)
    workbook = open_workbook(filepath, encoding_override='cp1252')

    # 获取第一个sheet
    sheet = workbook.sheet_by_name(sheetname)
    # 获取sheet0中的所有的行数和列数
    rows = sheet.nrows
    cols = sheet.ncols
    for i in range(1, cols):
        rvalue = sheet.row_values(rawnum)

    return rvalue

#def getRowsData(filename, sheetname):

#D = getRowsData('testData.xlsx', u'工作表1', 1)
#print D


